package com.coolw.spring.statemachine.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.coolw.common.api.BaseResult;
import com.coolw.spring.statemachine.dto.OrderDTO;
import com.coolw.spring.statemachine.entity.OrderEntity;
import com.coolw.spring.statemachine.enums.OrderStatusEnum;

/**
 * 订单服务接口
 *
 * @author coolw
 * @date 2024/4/8 16:40
 */
public interface OrderService extends IService<OrderEntity> {

    /**
     * 创建订单
     */
    BaseResult<String> create(OrderDTO orderDTO);

    /**
     * 订单支付
     */
    BaseResult<Boolean> pay(String orderId);

    /**
     * 订单发货
     */
    BaseResult<Boolean> deliver(String orderId);

    /**
     * 订单收获
     */
    BaseResult<Boolean> receive(String orderId);

    /**
     * 更新订单状态
     *
     * @param orderId         订单ID
     * @param orderStatusEnum 订单状态
     * @return 更新结果
     */
    boolean updateOrderStatus(String orderId, OrderStatusEnum orderStatusEnum);

    /**
     * 根据订单ID获取订单信息
     *
     * @param orderId 订单ID
     * @return 订单信息
     */
    OrderEntity getOneByOrderId(String orderId);
}
